package csdj.t309.drive.controller;

import csdj.t309.drive.entity.CityArea;
import csdj.t309.drive.entity.DriverSchool;
import csdj.t309.drive.service.CityAreaService;
import csdj.t309.drive.service.DriverSchoolService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class DriverSchoolController {
    @Resource
    private DriverSchoolService driveSchoolService;
    @Resource
    private CityAreaService cityAreaService;

    @GetMapping("/list")
    public String list(Model model){
        List<DriverSchool> driveSchoollist = driveSchoolService.selectAll();
        List<CityArea> searchList = cityAreaService.select();
        model.addAttribute("driveSchoollist",driveSchoollist);
        model.addAttribute("searchList",searchList);
        return "/list";
    }

    @GetMapping("/update")
    public String doSelect(Model model, Integer aid){
            List<CityArea> searchList = cityAreaService.select();
            model.addAttribute("searchList",searchList);
            return "/update";

    }

}
